package Stream_test;
import Lambda_Test.Print;


import java.util.*;
import java.util.stream.Stream;

public class test {
    public static void main(String[] args) {
        List<user> collection = new ArrayList<>();
        collection.add(new user(22, "孙悟空"));
        collection.add(new user(1, "猪八戒"));
        collection.add(new user(3, "泰森"));
        collection.add(new user(55,"灰太狼"));
        collection.add(new user(55,"灰太狼"));
        collection.add(new user(55,"灰太狼"));
        collection.add(new user(55,"灰太狼"));
        collection.add(new user(7, "喜羊羊"));
        collection.add(new user(38, "赵六"));
        collection.add(new user(4, "王五"));
        print(collection.stream().filter(x -> x.getId() % 2 == 0).toList());
        collection.stream().sorted((u1, u2)->u1.getId() - u2.getId()).forEach(System.out::println);
        collection.stream().distinct().forEach(System.out::println);

        System.out.printf("\n%d\n", 45);

    }

    static <T> void print(List<T> x)
    {
        System.out.println(x);
    }

}

